<?php

namespace app\api\controller;

class Base
{

    //注册功能
    public function register()
    {
        //传入学号，姓名，密码注册
        //规则1：学号唯一
        //规则2：密码md5加密
        $no = input('get_no');
        $name = input('get_name');
        $password = input('get_password');
        if (empty($on) || empty($password)) {
            output_error('请填写完整信息');
    }
        $data = \app\api\model\Student::where('member_on','=',$on)->find();
        if (!empty($data)) output_error('学号已被注册');
        $data = array();
        $data['member_on'] = $on;
        $data['member_name'] = $name;
        $data['member_password'] = md5($password);
        $data['member=token'] = '1';
        $data['member=gender'] = '1';
        $data['add_time'] = time();
        Student::insert($data);
        output_data(data:'1');
    }

    //找回密码
    public function findpass()
    {
        //通过学号，姓名重置密码
        $on = input('get.on');
        $name = input('get.name');
        $password = input('get.password');
        if(empty($on) || empty($name) ||empty($password)){
            output_error('请填写完整信息');
    }
        $conditon = array();
        $conditon[] = ['member_on, = , $on'];
        $conditon[] = ['member_name, =, $name'];
        $data = Student::wher($conditon)->find();
        if (empty($data)) output_error('学号与姓名不匹配');
        //规则1：密码md5加密
        \app\api\model\Student::where()



    }

    //登录功能
    public function login()
    {
        //通过学号，密码登录，返回Token
        //规则1：token由学号+当前时间戳md5加密生成
    }

}
